struct Frame;
class Neighborhood;

// Discretize a Frame and view it as a grid.
class FrameGrid
{
public:
    FrameGrid(const Frame &frame, int gridScale);
    ~FrameGrid() { if (data) delete[] data; }

    inline int height() const { return _height; }
    inline int width() const { return _width; }

    int getId(int x, int y) const;

    Neighborhood getNeighborhood(int x, int y, int size) const;
    Neighborhood getNeighborhood(int x, int y, int width, int height) const;

private:
    int _height;
    int _width;
    short *data;
};